<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>${_front_title}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/static/favicon.ico"/>
    <link rel="stylesheet" href="/static/front/fonts/iconfont.css">
    <link rel="stylesheet" href="/static/front/css/base_new.css">
    <link rel="stylesheet" href="/static/front/css/library.css">
    <link rel="stylesheet" href="/static/front/css/style.css">
    <script src="/static/front/js/jquery-1.11.1.min.js"></script>
    <script src="/static/front/js/jquery.countdown.js"></script>
    <script src="/static/front/js/js.js"></script>
    <!--[if lt IE 9]>
    <script src="/static/front/js/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script type="text/javascript" src="plugIn/PIE.js"></script>
    <![endif]-->
    <style>
    	.securityCenterModality{
    		display:none;
    	}
    	div#securityCenterMain table .one i{padding-left:0;}
    	div#securityCenterMain table .two{text-indent:0;}
    	div.securityCenterModality .userFrom .FU label{width:110px;text-align:left;padding-left:20px;}
    </style>
</head>

<body>
	<div class="content">
    <div class="modality securityCenterModality">
        <div class="user mailAuthenticationF">
            <h4>邮箱认证 <em class="iconfont close">&#xe621;</em></h4>
            <form class="userFrom" action="javascript:;">
                <p id="eMssage" class="redPrompt">
                	<#if (user?? && user.pEmail?? && user.pEmail !="")> 
                		您绑定的邮箱号码：${user.pEmail} 
					<#else>
						认证您的邮箱，保证您的资金安全
            		</#if>
                </p>
                <div class="mail clearfix FU">
                    <label for="mail" class="fl"><em>*</em> 绑定邮箱地址：</label>
                    <input class="fl aqrz" type="text" id="mail"  datatype="m" placeholder ="" 
                    <#if email?exists>readonly="readonly"</#if>
                    value="<#if email?exists>${email.authName}</#if>" style="background:none;">
                </div>
               <div class="mail clearfix FU">
                    <label for="mail" class="fl"><em>*</em> 确认邮箱地址：</label>
                    <input class="fl" type="text" id="amail"  datatype="m" placeholder ="" 
                    <#if email?exists>readonly="readonly"</#if>
                    value="<#if email?exists>${email.authName}</#if>">
                </div>
                <#if email?exists>
                	<input class="regsiterBtn noMargin" type="submit" <#if email?exists>style="background: #999;"</#if> value="确认">
                <#else>
                	<input id="but1" class="regsiterBtn noMargin" type="submit" value="确认提交">
                </#if>
            </form>
        </div>
        <div class="user realNameAuthenticationF">
            <h4>实名认证 <em class="iconfont close">&#xe621;</em></h4>
            <form action="javascript:;" class="userFrom">
               <!-- <p class="redPrompt" id="iMssage">
            		<#if (userAuth?? & userAuth.authName??)>
                		<#if userAuth.authName?length == 18>
							您绑定的身份证号： ${userAuth.authName[0..2]}***********${userAuth.authName[14..17]}
						<#elseif userAuth.authName?length == 15>
							您绑定的身份证号：${userAuth.authName[0..2]}********${userAuth.authName[11..14]}
						</#if>
					<#else>
						为保障您账户的安全，请如实填写真实姓名并保持和银行卡开户名一致，实名认证通过后将不能修改
            		</#if>
            	</p>-->
                <div class="name clearfix FU">
                    <label for="name" class="fl"><em>*</em> 真实姓名：</label>
                    <input type="text" id="name" class="fl" placeholder=""
                    <#if (user?? & user.realname?? & user.realname !="")>readonly="readonly"</#if> 
                    value="<#if (user?? & user.realname?? & user.realname !="")>${user.realname}</#if>" maxlength="20">
                </div>
                <div class="ID clearfix FU" >
                    <label for="ID" class="fl"><em>*</em> 证件号码：</label>
                    <input type="text" id="ID" class="fl" maxlength="18" placeholder=""
                    <#if (userAuth?? & userAuth.authName?? & userAuth.authName !="")>readonly="readonly"</#if>
                    value="<#if (userAuth?? & userAuth.authName?? & userAuth.authName !="")>${userAuth.authName}</#if>">
                </div>
                 <#if (userAuth?? & userAuth.authName?? & userAuth.authName !="")>
                 	<input class="regsiterBtn noMargin" type="submit" <#if (userAuth?? & userAuth.authName?? & userAuth.authName !="")>style="background: #999;"</#if> value="确认">
                 <#else>
                	<input id="but2" class="regsiterBtn noMargin" type="submit" value="确认提交">
                </#if>
            </form>
        </div>
        <div class="user modifyLoginPasswordF">
            <h4>修改登录密码<em class="iconfont close">&#xe621;</em></h4>
            <form action="javascript:;" class="userFrom phoneRegsiter">
                <p class="redPrompt" id="pMssage">为保障您账户安全，请定期更换登录密码确保与提现密码不同</p>
                <div class="originalPassword clearfix FU">
                    <label for="originalPassword" class="fl"><em>*</em> 原始密码：</label>
                    <input type="password" id="originalPassword" class="fl">
                </div>
                <div class="NewPassword clearfix FU">
                    <label for="NewPassword" class="fl"><em>*</em> 新密码：</label>
                    <input type="password" id="NewPassword" class="fl" placeholder="由字母、下划线和数字组成">
                </div>
                <div class="confirmPassword clearfix FU" >
                    <label for="confirmPasswordPhone" class="fl"><em>*</em> 确认密码：</label>
                    <input type="password" id="confirmPasswordPhone" class="fl" placeholder="由字母、下划线和数字组成">
                </div>
                <input id="but3" class="regsiterBtn noMargin" type="submit" value="确认提交">
            </form>
        </div>
         <!--<div class="user modifyLoginPasswordF">
            <h4>绑定银行卡<em class="iconfont close">&#xe621;</em></h4>
            <form action="javascript:;" class="userFrom phoneRegsiter">
                <p class="redPrompt" id="pMssage">该银行卡为您提现的唯一卡号</p>
                <div class="originalPassword clearfix FU">
                    <label for="originalPassword" class="fl"><em>*</em> 绑定银行卡号：</label>
                    <input type="text" id="originalPassword" class="fl" placeholder=""
                    <#if (pageInfo?exists & pageInfo.pageList?size>0)>readonly="readonly"</#if>
                    value="<#if (pageInfo?exists & pageInfo.pageList?size>0)><#list pageInfo.pageList as model><#if model.cardNo?exists>${model.cardNo}</#if></#list></#if>">
                </div>
                <input id="but3" class="regsiterBtn noMargin" type="submit" <#if (pageInfo?exists & pageInfo.pageList?size>0)>style="background: #999;"</#if>value="确认提交">
            </form>
        </div>-->
    </div>
    
	<!-- 头部 开始 -->
    <div id="header">
		<#include "../base/top.ftl" />
	</div>
	<!-- 头部 结束 -->
		
    <div id="securityCenterMain" class="cnt clearfix layoutMain">
        <#include "base1.ftl" />
        <div class="fr securityGuarantee">
            <h2 class="clearfix">
            	<span class="fl">安全保障</span> 
	            <span class="fr right clearfix">
		            <i class="fl">安全等级：</i>
		            <em class="fr">
		            <#if authMap["count"]==4>
               			非常高
               		<#elseif authMap["count"]==3>
               			较高
               		<#elseif authMap["count"]==2>
               			一般
               		<#elseif authMap["count"]==1>
               			较低                        			                           			
               		</#if>
               		</em>
	            </span>
            </h2>
            <table>
                <tr>
                    <td class="one">
	                    <span>
	                    	<em class="iconfont success">&#xe620;</em>
	                   		&nbsp;<i>手机认证</i>
	                    </span>
                    </td>
                    <td class="two">您的手机已经通过认证，认证的手机号码为：
                    	<em><#if (user?? && user.phone?exists)>${user.phone[0..3]}****${user.phone[7..10]}</#if></em>
                    </td>
                    <td class="alreadyCertified" style="border-bottom:1px solid #eeeeee;text-align:center;">已设置</td>
                </tr>
                <tr>
                    <td class="one">
                    	<span>
                    		<em class="iconfont <#if email?exists>success<#else>error</#if>">
                    			<#if email?exists>
                    				&#xe620;
                    			<#else>
                    				&#xe621;
                    			</#if>
                			</em>
                			<i>邮箱认证</i>
            			</span>
        			</td>
                    <td class="two">
                    <#if (user?? && user.pEmail?? && user.pEmail !="")>
                    	您的邮箱已经通过认证，认证的邮箱号码为：${user.pEmail}
                    <#else>
                    	认证您的邮箱，保证您的资金安全
                	</#if>
                    </td>
                    <td class="three">
                    	<#if email?exists>详情<#else>开始认证</#if>
                    </td>
                </tr>
                <tr>
                    <td class="one">
                    	<span>
	                    	<em class="iconfont <#if (user?? & user.realname?? & user.realname !="")>success<#else>error</#if>">
	                    		<#if (user?? & user.realname?? & user.realname !="")>
	                    			&#xe620;
	                    		<#else>
	                    			&#xe621;
	                    		</#if>
	                    	</em>
	                    	<i>实名认证</i>
                    	</span>
                	</td>
                    <td class="two">
	                    <#if (userAuth?? & userAuth.authName??)>
	                		<#if userAuth.authName?length == 18>
	                			您的身份证已经通过认证，认证的身份证号为：${userAuth.authName[0..2]}***********${userAuth.authName[14..17]}
							<#elseif userAuth.authName?length == 15>
								您的身份证已经通过认证，认证的身份证号为：${userAuth.authName[0..2]}********${userAuth.authName[11..14]}
							</#if>
						<#else>
							 实名进行资金账户操作，保证您的资金安全
	            		</#if>
                   </td>
                    <td class="three">
                    	<#if (userAuth?? & userAuth.authName?? & userAuth.authName !="")>详情<#else>开始认证</#if>
                	</td>
                </tr>
                <tr>
                    <td class="one">
	                    <span>
	                   		 <em class="iconfont success">&#xe620;</em>
	                   		 &nbsp;<i>登录密码</i>
	                    </span>
                    </td>
                    <td class="two red">为保证您的账户安全，请尽量设置复杂的密码</td>
                    <td class="three">修改密码</td>
                </tr>
                <!--<tr>
                    <td class="one">
                    	<span>
	                    	<em class="iconfont <#if (pageInfo?exists & pageInfo.pageList?size>0)>success<#else>error</#if>">
	                    		<#if (pageInfo?exists & pageInfo.pageList?size>0)>
	                    			&#xe620;
	                    		<#else>
	                    			&#xe621;
	                    		</#if>
	                    	</em>
	                    	<i>绑定银行卡</i>
                    	</span>
                	</td>
                    <td class="two">
                    <#if (pageInfo?exists & pageInfo.pageList?size>0)>
                    	您的银行卡已绑定，绑定的卡号为：
                    	<#list pageInfo.pageList as model><#if model.cardNo?exists>${model.cardNo[0..3]}***</#if></#list>
                    <#else>
                    	绑定银行卡进行资金账户操作，保证您的资金安全
                	</#if>
                	</td>
                    <#if (pageInfo?exists & pageInfo.pageList?size>0)>
                    	<td class="bundl three" style="border-bottom:1px solid #eeeeee;text-align:center;color:#3c9bf3;cursor:pointer">详情</td>
                   	<#else> 
                    	<td class="bundl" id="back_id" style="border-bottom:1px solid #eeeeee;padding-left:92px;color:#3c9bf3;cursor:pointer">绑定银行卡</td>
                    </#if>
                </tr>-->
            </table>
        </div>
    </div>
</div>
    <div id="footer">
      <div class="content">      
		<#include "../base/foot.ftl" />
      </div>
    </div>       
</div>
<!--<script type="text/javascript" src="${_front_js}/common.js" ></script>-->
<script type="text/javascript" src="${_front_js}/layer/layer.js" ></script>
<script type="text/javascript" src="${_front_js}/layer/extend/layer.ext.js" ></script>
<!--<script type="text/javascript" src="${_front_js}/idCard.js"></script>--> 

<script type="text/javascript">
	//邮箱认证
	$("#but1").click(function(){
		var email = $("#mail").val();
		var aEmail = $("#amail").val();
		//var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		var reg =  /^([\w\.\-]+)@([\w\.\-]+)\.([\w]{2,4})$/;
		if(email ==""){
			document.getElementById("eMssage").innerHTML="邮箱不能为空";
			return;
		}
		if(!reg.test(email)){
			document.getElementById("eMssage").innerHTML= "邮箱格式错误";
			return;
		}
		if(aEmail ==""){
			document.getElementById("eMssage").innerHTML= "确认邮箱不能为空";
			return;
		}
		if(email != aEmail){
			document.getElementById("eMssage").innerHTML="两次输入的邮箱不相同";
			return ;
		}
		$.ajax({
            cache: true,
            type: "POST",
            url:"/account/email",
            data:{
            	"email":email
            },
            async: false,
            success: function(result) {
            	if(result.code == -1){
            		layer.alert(result.msg, function(index){
	            		window.location.reload();
					});  
            	}else{
            		if(result.code == 0){
            			layer.alert(result.msg, function(index){
						    layer.close(index);
						}); 
            		}else{
            			if(result.code == 1){
					    	window.location.href="/login";
					    }else if(result.code == 4){
					    	document.getElementById("eMssage").innerHTML=result.msg;
					    }else{
					    	document.getElementById("eMssage").innerHTML=result.msg;
					    }
            		} 
            	}
            }
    	});
	});
	
	//实名认证
	$("#but2").click(function(){
		var realname = $.trim($('#name').val());
		var idCard = $.trim($('#ID').val());
		if(realname == ""){
			document.getElementById("iMssage").innerHTML="姓名不能为空";
			return;
		}
		if(idCard == ""){
			document.getElementById("iMssage").innerHTML="身份证不能为空";
			return;
		}
		
		var idno=new IDCard(idCard);
		if(!idno.CardValid){
			document.getElementById("iMssage").innerHTML="身份证号码有误";
			return;
		}
		if(idCard != ""){
			document.getElementById("iMssage").innerHTML="身份证认证后不可再更改，请确认！";
		}
		$.ajax({
			type : 'POST',
			async : 'false',
			url : '/account/setSafeVer',
			data : {"realname":realname, "idCard":idCard},
			success: function(result) {
				if(result.code == -1){
            		layer.alert(result.msg, function(index){
	            		window.location.reload();
					});  
            	}else{
            		if(result.code == 0){
            			layer.alert(result.msg, function(index){
						    layer.close(index);
						}); 
            		}else{
            			if(result.code == 1){
					    	window.location.href="/login";
					    }else if(result.code == 2){
					    	document.getElementById("iMssage").innerHTML=result.msg;
					    }else if(result.code == 3 || result.code == 4){
					    	document.getElementById("iMssage").innerHTML=result.msg;
					    }
            		}
            	}
			}
		});
	})
		
	//登录密码修改
	$("#but3").click(function(){
		var password = $.trim($('#originalPassword').val());
    	var newPassword = $.trim($('#NewPassword').val());
    	var againNewPassword = $.trim($('#confirmPasswordPhone').val());
    	if(password == ""){
    		document.getElementById("pMssage").innerHTML="请输入原始密码";
    		return; 
    	}
    	if(newPassword == ""){
    		document.getElementById("pMssage").innerHTML="请输入新密码";
    		return; 
    	}
    	if(againNewPassword == "" || againNewPassword != newPassword){
    		document.getElementById("pMssage").innerHTML="两次输入密码不一样";
    		return;
    	}
		$.ajax({
			type : 'POST',
			async : 'false',
			url : '/account/password/update',
			data : {"oldPassword":password,"newPassword":newPassword},
			success: function(result) {
				if(result.code == -1){
            		layer.alert(result.msg, function(index){
					    layer.close(index);
					    window.location.reload();
					});  
            	}else{
            		if(result.code == 0){
            			layer.alert(result.msg, function(index){
						    layer.close(index);
						}); 
            		}else{
            			if(result.code == 1){
					    	window.location.href="/login";
					    }else if(result.code == 2 || result.code == 4){
					    	document.getElementById("pMssage").innerHTML=result.msg;
					    }else if(result.code == 3){
					    	document.getElementById("pMssage").innerHTML=result.msg;
					    }
            		}
            	}
			}
		});
	});
	
	 function timeout(obj,count) {
		if (count == 0) {
			obj.removeClass("button-disabled");  
			obj.css("background","#d42424");           
		    obj.html("获取验证码");
		    count= 60;
		} else {
			obj.addClass("button-disabled");
			obj.css("background","");           
		    obj.html("重新发送(" + count + ")");
		    count--;
		    setTimeout(function() {
		        timeout(obj,count)
		    },
		    1000)
		}
    }
       $("#back_id").click(function(){
	       $.ajax({
				type : 'POST',
				async : 'false',
				url : '/account/bank/card',
				success: function(result) {
        			if(result.code == 1){
				    	window.location.href="/login";
				    	return;
				    }else if(result.code == 2){
				    	window.location.href="/account/register";
				    	return;
				    }
				    window.open("/hf/bank/card?uid=${user.id}"); 
				}
			});
    	
    })
       $("#NewPassword").blur(function(){
            if( $(this).val() == '' ){
                layer.alert("密码不能为空");
            }else if($(this).val().length<6){
                layer.alert("密码不能少于6位");
            }else if($(this).val().length >16){
                layer.alert("密码不能多于16位");
            }else if(/\W/g.test($(this).val())){
                layer.alert("密码不能为特殊字符");
            }else if(!/[^A-Z]/g.test($(this).val())){
                layer.alert("密码不能为纯字母");
            }else if(!/[^_]/g.test($(this).val())){
                layer.alert("密码不能为纯下划线");
            }else{
                  return;
            }
        })
      $(" #confirmPasswordPhone").blur(function(){
            if( $(this).val() == ''){
              layer.alert("确认密码不能为空");
            }else if( $passwordOk.val() != $password.val()){
              layer.alert("密码不一致，请再次输入密码");
            }else{
             return;
            }
        })
</script>

</body>
</html>
